The geeky way to play a game
2025-01-08 by: "flushy flushy.net via chugalug"
From: "flushy flushy.net via chugalug" ------------------------------------------------------ (If meuon see this, maybe he can reset my bounce flag - as I can only see messages on the website chatter link). Talking with meuon this past weekend, he mentioned some cool things folks were doing in the most geekiest way possible. So I mentioned a geeky way I solve cryptic crossword-like clues for a puzzle in a game I play online. https://github.com/gonoph/misc-scripts keywords.py - is a python3 script that I use to generate all possible combos from a list of letters. I then use that list to search my logs or query a database of unique items/names for the clue solution. Since some clues are unique names which are fantasy based names, they are not always real names, nor spelled using common language patterns. It uses a recursive function to do the bulk of the work. Also, the letters used can be included multiple times, so there can be duplicate keywords generated - which the script uses a "set" to ensure uniqueness. One of the last clues I had to solve involved 2 words, joined together to form a sequence of 12 letters. This posed a couple of problems. Problem 1: since the number of combinations is at worst 12 factorial, that's 479 million keywords. I didn't have the memory to generate that type of word list Problem 2: I also didn't have the time as my original script was single threaded. I solved Problem-2 by altering my script to be multi-threaded using Python's ProcessPoolExecutor class. I then solved Problem-1 by running a memory optimized instance in AWS for the time it took to generate the keywords I needed. I ran a single instance of r8g.8xlarge (32x vcores arm64 with 256 GiB of RAM) @ $1.88512 / hour. With my 2 problems solved, I generated the keywords in 10 minutes (for a cost of ~$0.31), then transferred the (compressed) file to my other system, and powered off and deleted the instance. End result: 59 million keywords, 743 MiB in size (uncompressed). Then started the hard part of scanning those keywords in logs and in the database. This process I used mysql and liberal use of cut, sort -u, split, and grep - with some shell to glue it together. I used a multi-step process: 1. trim the keywords from 12 to 6 letters, removing duplicates (trims it to ~150k words, and ~1 MiB). 2. perform partial match of the logs/database for those 150k words 3. record what entry and partial match 4. use the partial matches to filter the 59 million keywords to a filtered list 5. use the filtered list to re-match the previously matched entries 6. anything that has survived this point is potentially the solution Anyways, I'd love to hear how other folks are using their geeky skill to perform mundane tasks for fun! --b=============================================================== From: Wil Wade via chugalug ------------------------------------------------------ I use a little bookmarklet to clip every coupon at publix. So I put in my phone number at checkout and get random coupons! https://gist.github.com/wilwade/aafaf972e6e442c6224b8dcc676f1e4b
=============================================================== From: "flushy flushy.net via chugalug" ------------------------------------------------------ Oh that's a great idea! --b
=============================================================== From: Eric Beavers via chugalug ------------------------------------------------------ Thanks for sharing. This is delightful!